<?php if($this->pagecount>1):?>
<?php $max=$this->page+5;if($max>$this->pagecount)$max=$this->pagecount;?>


<div class="paginator">
<?php if ($this->page!=1):?>
		<a href="<?php echo $this->link."1"?>">&laquo; Первая</a>
<?php endif;?>
<?php if($this->page>5):?>

    <?php for ($i=$this->page-5;$i<=$max;$i++):?>
		<?php if($i!=$this->page):?>
			<a href="<?php echo $this->link.$i?>"><?php echo $i?></a>
		<?php else:?>
			<span><?php echo $i?></span>
		<?php endif;?>
	<?php endfor;?>
<?php endif;?>	

<?php if($this->page<=5):?>
    	
    <?php for ($i=1;$i<=$max;$i++):?>
		<?php if($i!=$this->page):?>
			<a href="<?php echo $this->link.$i?>"><?php echo $i?></a>
		<?php else:?>
			<span><?php echo $i?></span>
		<?php endif;?>
	<?php endfor;?>
<?php endif;?>	


<?php if ($this->page!=$this->pagecount):?>
		<a href="<?php echo $this->link.$this->pagecount?>">Последняя &raquo;</a>
<?php endif;?>
</div>
<div class="paginator_title">
Страница - <span style="color:red"><?php echo $this->page?></span> из <?php echo $this->pagecount?>
</div>
<?php endif;?>